<script type="text/javascript" src="{{$LAYOUT_HELPER_URL}}admin/js/ckeditor/ckeditor.js"></script> 
<script type="text/javascript" src="{{$LAYOUT_HELPER_URL}}admin/js/ckfinder/ckfinder.js"></script>  
<link href="{{$LAYOUT_HELPER_URL}}admin/js/jquery-ui/css/ui-lightness/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="{{$LAYOUT_HELPER_URL}}admin/js/jquery-ui/js/jquery-ui.js"></script>
<script src="{{$LAYOUT_HELPER_URL}}admin/js/jquery.slug.js"></script>

<script type="text/javascript">
jQuery(document).ready(function (){
    //Datepicker
    jQuery( ".date" ).datepicker({
        showAnim        : 'slideDown',
        showButtonPanel : true,
        dateFormat      : '{{$datepickerFormat.js}}'
    });
    
});
function addInput()
{
     var value = $("#a").val();
     
     jQuery.ajax({
         url: '{{$APP_BASE_URL}}product/admin/add-input',
       type: "POST",
       data: {'value':value},
         beforeSend: function( xhr ) {
         },
         success: function( data ) {
        //Do anything
            //alert(data);
             appendOptionLast(data,value);
         }
      });
}

function appendOptionLast(num,value)
{
  var elOptNew = document.createElement('option');
  elOptNew.text =  value;
  elOptNew.value =  num;
  var elSel = document.getElementById('add');

  try {
    elSel.add(elOptNew, null); // standards compliant; doesn't work in IE
  }
  catch(ex) {
    elSel.add(elOptNew); // IE only
  }
}


</script>
<style type="text/css">
    #images { list-style-type: none; margin: 0; padding: 0;}
    #images li { margin: 10px; float: left; text-align: center;  height: 180px;}
    #files { list-style-type: none; margin: 0; padding: 0;}
    #files li { margin: 10px; height: 30px;}
    #properties { list-style-type: none; margin: 0; padding: 0;}
    #properties li { margin: 10px; height: 700px;}
</style>
            <div class="content-box"><!-- Start Content Box -->
                
                <div class="content-box-header">
                    
                    <h3>Bán sản phẩm</h3>
                    
                    <div class="clear"></div>
                    
                </div> <!-- End .content-box-header -->
                
                <div class="content-box-content">
                
                    <form action="" method="post">
                    
                    <!-- LANGUAGES -->
                    <div class="tab-content" id="tab{{$lang.lang_id}}">
                            
                            <!-- ERROR -->
                        {{if $errors|@count > 0}}
                        <div class="notification error png_bg">
                            <a href="#" class="close"><img src="{{$LAYOUT_HELPER_URL}}admin/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>
                            <div>
                                {{if $errors.main}}
                                    Error: {{$errors.main}}
                                {{else}}
                                    Error: Please check following information again
                                {{/if}} 
                                                                       
                            </div>
                        </div>
                        {{/if}}
                            
                            
                            <fieldset> <!-- Set class to "column-left" or "column-right" on fieldsets to divide the form into columns -->
                                
                                
<!--                                <p>-->
<!--                                    <label>Sorting<span class="red">*</span><br/><br/></label>-->
<!--                                        <input class="text-input small-input" type="text"  name="data[sorting]" value="{{$data.sorting}}" />{{if $errors.repeat_password}}<span class="input-notification error png_bg"></span>{{/if}}-->
<!--                                        <br /><small>No 1 will display as first article</small>-->
<!--                                </p>-->
                               

                                <p>
                                    <label>Tên sản phẩm</label>
<!--                                    {{$product.title}}-->
                                    <input class="text-input small-input" type="text"  name="product[title]" value="{{$product.title}}" />
                                </p>
                                </br>
                               <p>
                                    <label>Nhà sản xuất</label>
                                    <input class="text-input small-input" type="text"  name="data[provider]" value="{{$product.provider}}" />
                                </p>
                                
                               <p>
                                    <label>Ngày bán</label>
                                        <input class="text-input small-input date" type="text"  name="data[created_date]" value="{{$date}}" />
                                        <br /><small>Format: {{$datepickerFormat.display}}</small>
                                </p>
                                
                                <p>
                                    <label>Giá bán</label>
                                    <input class="text-input small-input" type="text"  name="data[sale_price]" value="" />
                                    <br /><small>ngàn đồng (VND)</small>
                                </p>
                                
                                <p>
                                    <label>Số lượng</label>
                                    <input class="text-input small-input" type="text"  name="data[soluong]" value="" />
                                    <br /><small>đơn vị</small>
                                </p>
                                
                                  
                                  
                                    <br/>
                                    <br/>
                                    <p>
                                     <label>Đơn vị</label>
                                    <select id="add" name="data[unit]" class="small-input">
                                   {{foreach from=$allUnits item=item}}
                                        <option value="{{$item.unit_id}}" {{if $item.unit_id == $product.unit}}selected="selected"{{/if}}>{{$item.name}}</option>
                                    {{/foreach}}
                                    </select> 
                                </p>
                                 <p>
                                   
                                    
                                     <label>Thêm đơn vị</label>
                                    <input id="a" class="text-input small-input" type="text"  name="add[unit]" value=""  />
                                    <input class="button" onclick="addInput();" type="button" value="Thêm" />
                                    </p>
                                                          
                                
                             
                                
                                
                                <p>
                                <br/>
                                    <input class="button submit" type="button" value="Save" />
                                </p>
                                
                            </fieldset>
                            
                            <div class="clear"></div><!-- End .clear -->
                            
                    </div>
                                
                        
                    
                  </form>
                  
                </div> <!-- End .content-box-content -->
                
            </div> <!-- End .content-box -->
            
            
            <div class="clear"></div>

